package com.test.design.pattern.combination;

/**
 * @ClasName MenuComponent
 * @Descripution TODO
 * @Author leikw
 * @Date 2021/12/18 11:32
 * @Version V1.0
 */
public abstract class MenuComponent {

    protected String name;
    protected int level;

    //添加子菜单
    public void add(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    //移除子菜单
    public void remove(MenuComponent menuComponent) {
        throw new UnsupportedOperationException();
    }

    //获取指定的子菜单
    public MenuComponent getChild(int index) {
        throw new UnsupportedOperationException();
    }

    public String getName() {
        return name;
    }

    //打印菜单名称的方法（包含子菜单和字菜单项）
    public abstract void print();

}
